//
//  M_tags.m
//  suRead
//
//  Created by 李 诗洋 on 15/12/28.
//  Copyright © 2015年 bao. All rights reserved.
//

#import "M_tags.h"

@implementation M_tags

+ (NSDictionary *)JSONKeyPathsByPropertyKey
{
    return @{
             @"f_catid": @"catid",
             @"f_catName": @"catname",
             @"f_wohs":@"wohs"
             };
}

+ (NSValueTransformer *)f_wohsJSONTransformer {
    
    return [MTLValueTransformer transformerUsingForwardBlock:^(NSString *price_, BOOL *success, NSError **error){
        
        if (!price_) {
            return @0;
        }
        
        return @([price_ integerValue]);
    }];
}

+ (BOOL)supportsSecureCoding {
    return YES;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    [aCoder encodeObject:self.f_catid forKey:@"catid"];
    [aCoder encodeObject:self.f_catName forKey:@"catName"];
    [aCoder encodeInteger:self.f_wohs forKey:@"wohs"];
}

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { // NS_DESIGNATED_INITIALIZER
    if (self = [super init]) {
        self.f_catid = [aDecoder decodeObjectForKey:@"catid"];
        self.f_catName = [aDecoder decodeObjectForKey:@"catName"];
        self.f_wohs = [aDecoder decodeIntegerForKey:@"wohs"];
    }
    return self;
}

@end
